Repository navigation
[FIX] base_exception: reload the view after the exception dialog - #3734
Conversation
|
Hi @hparfr, @sebastienbeau, |
|
@grindtildeath could you take a look? This follows up on #3590 and OCA/sale-workflow#4255, so you are the one with the context. The dialog can now confirm the record, and closing it leaves the view showing the previous state. Reloading on close seemed like the smallest fix |
The dialog can confirm the record (ticking "Ignore Exceptions" calls action_confirm on it), but closing it only closes the dialog: the view underneath keeps showing the record as it was before, so the user sees a quotation that is already a sales order. Reload once the dialog closes.
cd33a21 to
c97fa01
Compare
UsmanGhias
left a comment
There was a problem hiding this comment.
Clean patch for OCA/server-tools.
Observations:
- Template and component structure preserves standard inheritance patterns.
Ready for testing on standard environments.
Best,
Usman
grindtildeath
left a comment
There was a problem hiding this comment.
Makes sense, thank you 👍
|
This PR has the |
| await env.services.action.doAction(popupAction); | ||
| await env.services.action.doAction(popupAction, { | ||
| onClose: () => | ||
| env.services.action.doAction({ |
There was a problem hiding this comment.
Just wondering, shouldn't we instead do the soft reload before the popup is opened?
AFAIU we could modify the error handler below instead and do this at line 25:
const excData = JSON.parse(originalError.data.message);
env.services.action.doAction({
type: "ir.actions.client",
tag: "soft_reload",
});
if (excData.target_model === controller.props.resModel) {
env.services.action.doAction({
type: "ir.actions.client",
tag: "popup_exception",
});
}
return true;
There was a problem hiding this comment.
@grindtildeath the soft reload before the popup is already there — action.restore(controller.jsId) a couple of lines above, that's what makes the exception show up on the form.
What this PR fixes happens after: the dialog can confirm the record (Ignore Exceptions + Confirm runs action_ignore_exceptions() + action_confirm()), so when it closes the order is already state=sale while the form still shows the quotation and the exception banner. A reload before the popup can't reflect a change that hasn't happened yet.
I tried both on 18.0 with a non-blocking rule: with the reload moved to the handler, the form stays on "Quotation" with the banner while the record is confirmed in DB — same as without the fix. With onClose it reloads as expected.
|
@simahawk Hi, can you check this? |
|
/ocabot merge patch |
|
On my way to merge this fine PR! |
|
Congratulations, your PR was merged at e4712e6. Thanks a lot for contributing to OCA. ❤️ |
The problem
Confirm a sales order that hits an exception rule. The dialog shows up, you tick Ignore Exceptions and confirm.
The order is confirmed — but the view behind the dialog still shows it as a quotation, with the red exception banner and the Confirm button. You have to reload the page by hand to see the real state, and until you do you can hit Confirm again on an order that is already confirmed.
How to reproduce
On 18.0 with
sale_exceptioninstalled:exception.ruleonsale.order,by_py_code, that matches one customer.salein the database. Reload the page and the real state appears.Why
The dialog can change the record: ticking "Ignore Exceptions" calls
action_confirmon it. But the wizard returnsir.actions.act_window_close, which closes the dialog and nothing else, so the view keeps the state it had before.The fix
Reload once the dialog is closed, using the
onCloseoption ofdoAction:It goes here rather than in the wizard's return value for two reasons:
action_confirmon the wizard is inherited by several modules, and this way the fix covers every model using the mechanism, not just sales.